export default (G6, cfg) => {
    G6.registerEdge('line-arrow', {
        options: {
            style: {
                stroke: '#F6BD16',
                startArrow: {
                    path: 'M 0,0 L 12,6 L 9,0 L 12,-6 Z',
                    fill: '#F6BD16',
                },
                endArrow: {
                    path: 'M 0,0 L 12,6 L 9,0 L 12,-6 Z',
                    fill: '#F6BD16',
                },
            },
        },
        draw: function draw(cfg, group) {
            const startPoint = cfg.startPoint;
            const endPoint = cfg.endPoint;

            const stroke = (cfg.style && cfg.style.stroke) || this.options.style.stroke;

            const keyShape = group.addShape('path', {
                attrs: {
                    path: [
                        ['M', startPoint.x, startPoint.y],
                        ['L', endPoint.x / 3 + (2 / 3) * startPoint.x, startPoint.y],
                        ['L', endPoint.x / 3 + (2 / 3) * startPoint.x, endPoint.y],
                        ['L', endPoint.x, endPoint.y],
                    ],
                    stroke,
                    lineWidth: 1,
                    startArrow:true,
                    endArrow:true,
                },
                className: 'edge-shape',
                name: 'edge-shape',
            });
            return keyShape;
        },
    });
}